package com.itheima.tlias.mapper;

import com.itheima.tlias.pojo.dto.SelectClazzDTO;
import com.itheima.tlias.pojo.entity.Clazz;
import com.itheima.tlias.pojo.po.InsertClazzParam;
import com.itheima.tlias.pojo.po.SelectClazzPageParam;
import com.itheima.tlias.pojo.po.UpdateClazzParam;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ClazzMapper {
    List<SelectClazzDTO> selectClazzByPage(SelectClazzPageParam param);

    int insertClazz(InsertClazzParam param);
    @Select("select id,name,room,begin_date,end_date,master_id,subject,create_time,update_time from clazz where id = #{id}")
    SelectClazzDTO selectClazzById(Integer id);

    int updateClazz(UpdateClazzParam param);

    @Select("select * from clazz where name = #{name}")
    Clazz selectClazzByName(String name);
    @Delete("delete from clazz where id = #{id}")
    int delectClazzById(Integer id);

    @Select("select * from clazz")
    List<SelectClazzDTO> selectClazzAll();
}
